import requests


def spider():
    url = "https://api.bilibili.com/x/space/arc/search?"
    """ 
                'authority': 'api.bilibili.com',
                'method': 'GET',
                'path': '/x/space/arc/search?mid=32187583&ps=30&tid=0&pn=1&keyword=&order=pubdate&jsonp=jsonp',
                'scheme': 'https',
                'accept': 'application/json, text/plain, */*',
                'accept-encoding': 'gzip, deflate, br',
                'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
                'cookie': "_uuid=5A062230-791E-5FF4-CC6A-7012A98BA8EC60499infoc; buvid3=3E804B57-E220-4A72-ACCF-30CB67557EFD184999infoc; bfe_id=61a513175dc1ae8854a560f6b82b37af",
                'origin': 'https://space.bilibili.com',
                'referer': 'https://space.bilibili.com/',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'same-site',
     """  # 其他headers
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
    }
    params = {
        "mid": "32187583",  # UP的UID
        "ps": "30",  # pagesize,需要接口回复多少个视频的数据，上限100（缺省值20）
        "tid": "0",
        "pn": "1",  # page,在上面pagesize分页下的第多少页（缺省值1）
        "keyword": "",
        "order": "pubdate",
        "jsonp": "jsonp",
    }

    response = requests.get(url=url, params=params, headers=headers).content.decode()

    print(response)


if __name__ == "__main__":
    spider()
    print("over!")
